TreeLab said...
Would it be feasible to transfer the MIDI file from the SD to the EEPPROM, then read the track chunks from there? Would the speed be adequate?
Cheers!
Paul Rowntree
I don't see an advantage to that. Especially because an EEPROM only can be written so many times. There may be some speed advantage, but the writing issue is a bigger one for me.
Perhaps I do not understand the problem. If the trouble with the existing SD drivers is that they are essentially sequential readers, then a solution is to transfer the information once into a more flexible media format, then play the MIDI from there. RAM is out fro the Prop 1, so why not use the EEPROM? I think that the number of write cycles is still essentially infinite (10^6 plays at several minutes each should give several years of music before EEPROM failure, assuming every play required a re-write to memory).
TreeLab said...
Perhaps I do not understand the problem. If the trouble with the existing SD drivers is that they are essentially sequential readers, then a solution is to transfer the information once into a more flexible media format, then play the MIDI from there. RAM is out fro the Prop 1, so why not use the EEPROM? I think that the number of write cycles is still essentially infinite (10^6 plays at several minutes each should give several years of music before EEPROM failure, assuming every play required a re-write to memory).
Have I missed something here?
Cheers!
Paul Rowntree
Paul,
I consider several years of viable use a problem. I think using up an eeprom just to get around the multi-read of an SD card not smart. I would rather stick with the format 0 than to burn up an eeprom.
> - why decay and release time values are the same? Maybe it would be great having two different values.
> - why not adding an LFO to modulate DCA and or PM?
The synthesizer engine is designed to use a minimum of parameters, to get as much voices in 1 cog as possible. For a midi
file player the number of voices is more important than a voice architecture which allows detailed modelling of the sound.
When 20 voices plays, you can't hear if the release is a bit shorter than the decay time, or if there is an LFO modulation.
The cog ram is very limited, and the current implementation uses the whole ram (not 1 register/instruction left free).
It is possible to make a more advanced synthesizers, with lower voice count. Perhaps one voice in one cog and with external
analog filter hardware. Sometimes I dream of this, but had not the time so far...
What I miss most in the current design are the continous controllers, like expression and pitch bending. Many midi files uses
such controllers, and this results in wrong notes and wrong mixing balance of the voices.
Writing to the tracks to an EEPROM would be possible, but only for short midi files. But I have here files up to 400 kByte, to
big for an EEPROM.
As I said before, it will be possible to play a file in format 1, with a lot of effort on the SD card driver. One way will be, to have the midi files with contiguous sectors, and access the tracks with low level sector reads.
But I really don't see, why it is so important to play Format 1 files. Converting the files to format 0 is easy, and makes the software so much simpler.
The format 1 is mainly ment as a portable file format between sequencers. The tracks are separated in the file so that another sequencer can reconstruct the track structure. Playing the file is always a mix down to one midi stream, which makes the sequencer in realtime while playing.
We're all going to need to adopt an add-on RAM option like
that of the SRAM interface by Ray, or Andre. Like those many
who are using an SD interface, this would solve many of the
problems like this one. Andy if you had some memory you
could spool it off to, problem with playback of midi 1 would
be pretty much solved.
It is also possible to change the settings of the Windows Mediaplayer, so that it plays MIDI files always over the
Serial MIDI port, then you can hear all the MIDI files from the NET direct on the propeller by simply clicking on
the link.
Finally got a chance to set this up.. VERY NICE.
Here's the exact changes for adjusting Media Player (and others) for proper Midi output.
START-->Control Panel-->Sounds and Audio Devices-->Audio Tab
Pull down the "Midi Playback Device" and choose the Roland device.
After playing with this for a while I thought it might be a little more interesting
with some sort of color display. Attached is a version of "Midi Expander" with
a sort of multicolor display player. (ie: simple lightshow)
It brought a smile to my face, so I thought I'd share it. I thinking I might incorporate
this into some sort of PropDOS midi player with a fun display.
Follow Andy's instructions above for setting up the Roland Serial Driver for this.
What's about compressing the Midi-File and to have an uncompressing algorithm in the propeller? If we take a look on the Lins Akkeson demo, there should be a possibility to write a simple compressing algorithm.
I tried a little bit to play arround with your synthesizer object, but I do not realy understand the parameter list of your methods. Can you explain how I can generate the different instruments voices? I don't know the midi parameters, so I couldn't unterstand what paramter the functions need. Here is my little test program with which I could generate different pitches ( in your term notes ). But how could I alter the instrument?
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OneSecond = 80_000_000
Left = 10 '<-- Audio Out pins
Right = 11
LedPin = 16
OBJ
synth : "pm_synth_20"
VAR
LONG i
PUB Main
Pins for your hardware)
synth.start(Left,Right,2) 'start synth with 20 voices
dira[noparse][[/noparse]LedPin]:=1
i:=1
repeat 50
synth.noteOn(50+i,2,100) 'pitch,midichannel,velocity
waitcnt(OneSecond/10+cnt)
i++
!outa[noparse][[/noparse]LedPin]
synth.allOff
You can change the sound with the prgChange methode of the object: synth.prgChange(SoundNumber,MidiChannel).
MIDI has 16 different channels (0..15), and every channel can play another sound. The General MIDI standard defines 128 sound numbers, look in the table inside the object to see the assigned Instruments. If you set a sound for a channel, then all notes sent with noteOn to this channel play this sound.
Every note you play needs also a noteOff to stop the the note. You can see the noteOn as pressing a key on a keyboard and noteOff for release the key. If you only use noteOn, it's like pressing many,many keys and never release theme.
Channel 10 is special in that it is for the drums, and every note plays another sound. Again the table shows the drum sound numbers.
Be aware that MIDI defines the number range different from the real passed number: The instruments 1..128 are in reality 0..127, and the channels 1..16 are 0..15 (to play drums you must pass 9 as channel number).
There are also methodes in the object to set the Main volume and the panorama position per channel, both with values from 0..127.
If you want change the instrument sounds itself, then you have to edit parameters in the table of the object, this is not possible with MIDI commands.
Thank you for the help. I made a new test program:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OneSecond = 80_000_000
Left = 10 '<-- Audio Out pins
Right = 11
TestLed = 16
OBJ
synth : "pm_synth_20"
VAR
LONG i
LONG Note
Long Channel
Long Instrument
PUB Main
synth.start(Left,Right,2) 'start synth with 20 voices
{
List of commands for pm_synth_20
================================
start(Lpin, Rpin, Cogs) : okay ==> start synthesizer in a COG
stop == stop synthesizer
noteOn(key, chan, vel)==> turn on sound (pitch,midichannel,velocity)
noteOff(key, chan)==>turn off sound
prgChange(num, chan)==> change the instrument in a channel, instruments: 0..127
volContr(vo, chan)==> volume control
panContr(pa, chan)
allOff ==> all channels off
channel 10 ==> drum channel, every note plays another sound
}
dira[noparse][[/noparse]TestLed]:=1
'fast note on/off test
Channel:=1
Note:=70
repeat 50
synth.noteOn(Note,Channel,100) 'pitch,midichannel,velocity
waitcnt(OneSecond/20+cnt)
synth.noteOff(Note,Channel)
waitcnt(OneSecond/20+cnt)
'test different instruments
Note:=80
Channel:=0
Instrument:=0
repeat 127
synth.prgChange(Instrument,Channel)
synth.noteOn(Note,Channel,100) 'pitch,midichannel,velocity
waitcnt(OneSecond/10+cnt)
synth.noteOff(Note,Channel)
waitcnt(OneSecond/10+cnt)
Instrument++
!outa[noparse][[/noparse]TestLed]
'play notes in an upcounting sequence
Channel:=2
Note:=60
i:=1
Instrument:=85 'instrument = a kind of flute?
synth.prgChange(Instrument,Channel)
repeat 50
synth.noteOn(Note+i,Channel,200) 'pitch,midichannel,velocity
waitcnt(OneSecond/20+cnt)
synth.noteOff(Note+i,Channel)
waitcnt(OneSecond/20+cnt)
i++
!outa[noparse][[/noparse]TestLed]
synth.allOff
synth.stop
I made some observations: in the first example, The sound seems to alter a little bit during the 50 repetitions.
I don't know how to interpret 'velocity': is it attack, decay? A value of 500 seems to give the maximum loudness, but sometimes also a little noise.
if I change to Channel 9 ( drums ) it seems not to work. ( at least in the example code )
I made some observations: in the first example, The sound seems to alter a little bit during the 50 repetitions.
I don't know how to interpret 'velocity': is it attack, decay? A value of 500 seems to give the maximum loudness, but sometimes also a little noise.
if I change to Channel 9 ( drums ) it seems not to work. ( at least in the example code )
chris
Yes it seams that the voices of the second cog play louder than the first cog. So after every 10 notes the sound change a little bit.
Velocity defines how hard a note is played. Soft=0...hard=127. Its called velocity or dynamic, because a synth keyboard measures the time between the released state of a key and the full pressed state. If you play harder, the key is faster pressed down, and therefore velocity is higher.
A high Velocity value makes the sound louder and also changes the harmonics a bit for some sounds.
It would help you if you study the MIDI specification a little bit: en.wikipedia.org/wiki/General_MIDI and the links there.
Try the following examples for drums and chords: (copy it in your test loop)
Still playing with Andy's Synth. [noparse]:)[/noparse]
I wanted an easy way to experiment with creating different sounding instruments so I wrote this program.
Displays all of the variables for an instrument on the screen, allowing you to adjust them up/down
and try them out with a simple scale. Starts out with Grand Piano settings, then you take it from there.
{Personal favorite is dropping the PhaseMod to 0}
I'm hoping to come up with some nice 80's synth sounds this way. [noparse]:)[/noparse]
thanks for your help. As attachement, my beginners test programm.
Do you know, where I can find some free midi files in the net? ( yes I know google, but since midi files are used in cell phones, its very difficult to find some example midi files for free ). In earlier days I hat a 3,5inch disk with a lot of midi files for my Atari ST.
I'm thinking about some simple compressing algortihm which conpresses the midi-file to some microcontroller readable attachement ( C include file or spin data ).
It seems to me as if midi files are easy to compress. And the Linus Akkeson demo "turbulence" shows, that there a lot of music can be stored in the propeller. Probably it would be good to write a little java programm to generate the midi compressed resource.
Is anybody out there who knows if such a programm exists? At least Linus has done one.
Chris Micro said...
Do you know, where I can find some free midi files in the net?
There are a lot at ClassicalArchives.com. I haven't been to the site in a while. I just took a quick look and it looks like they are more heavily into MP3 these days, but there are still MIDI files if you look closely.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ OS-X: because making Unix user-friendly was easier than debugging Windows
Here is a search engine for free MIDI files: www.midisite.co.uk/
Some post back OBC has recommended this site, and I have found some good files there: www.midimole.com/
Cluso99
The Audio circuit was ment as Line out. I use it with a pair of activ PC loudspeaker boxes.
But because you have asked, I tried it out with 2 Earphones from an old Walkman and an MP3 player.
I was surprised that it get a clear sound with one of the earphones, only a bit quiet (definitly no ear damage possible[noparse]:)[/noparse]
The other one has a sound like thru a phone, but also not really bad.
One problem of the circuit is the missing decoupling C, so you have a lot of DC current thru the coil of the headphone.
Attached is version of the Audio out which should sound much better, but I have it not tried so far...
Yes I was planning on putting a blocking cap - thought 1uF mono (no polarising). I was wondering if I could then use it as a stereo input??? (I am not proficient in analog)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Links to other interesting threads:
Question: Can you give an example of how to hold a note as long
as bit is switched? I'm using some PING))) sensors with this object
to create a very funky synth. At the moment I'm getting pauses
in the note which sound funny doing an organ or wind intrument
with this object.
I don't know if I got this right, but here is a code which starts a note if a bit goes high and stops it when the bit goes low.
You can add as many bit tests you need in the repeat loop. Every bit can play another note, also on another channel, to get
different sounds.
...
key1 := 60
key2 := 64
ch1 := 0
sound1 := 18
synth.prgChange(sound1,ch1)
oldina := ina
repeat
if (ina ^ oldina) & 1<<bit1 'bit1 changed?
if ina[noparse][[/noparse]bit1]
synth.noteOn(key1,ch1,120) '0->1
else
synth.noteOff(key1,ch1) '1->0
if (ina ^ oldina) & 1<<bit2 'bit2 changed?
if ina[noparse][[/noparse]bit2]
synth.noteOn(key2,ch1,120) '0->1
else
synth.noteOff(key2,ch1) '1->0
oldina := ina
Yes with the new FSRW a Format 1 player should be doable, not because it's faster, but because the driver allows to read several files at the same time. So it should also be possible to read the same file at several positions with the right number of instances of the FSRW object.
I just have not the time, to do it now. And I know, if I program something which produces music, this needs a lot of time, because every time a part works, I always get lost in hearing music instead of continue programming.
Hi Andy, this is absolutely awesome! Congratulations!
Could you explain, in a few words, the basic principle how you managed to implement as many as 20 oscillators (plus envelope) in one cog that has only two hardware timers? How do you get the frequencies right? And are you using the Propeller's built-in sine table?
The cog-counters are not used for the oscillators, they are used for the DACs (in DUTY mode).
The whole cog has a single loop which runs exactly with a rate of 32 kHz. The code in this loop is splitted in 12 time slices.
10 time slices calculates the 10 voices, 1 slice calculates a single envelope, and the 12.th slice calculates the mixing of the 10 voices, limits the max. and min. value and writes the samples to the DACs.
A voice has 2 oscillators. The Oscilllators are made with the DDS (Direct Digital Synthesis) principle, you will find a lot of informations in the NET about that, but here is my short explanation:
You have a phase and a frequency register. The freq.register is added to the phase register once every 32 kHz. So the phase-accumulator increases with a rate depending of the value of the freq.register. Because the register has a limited size (32bit) the phase register rolls over after a while (see (1) in my picture). The phase is a signed register, so the roll-over occures from $7FFF_FFFF to $8000_0000 (the most positive to the most negative value). The frequency off the roll overs is the frequency of the oscillator that you will hear. And because the value of phase is continuously increasing between the roll overs, you get a Sawthooth waveform. To produce higher or lower oscillator frequencies you need just to vary the freq-register value (2).
The right freq.register values for the notes are precalculated in the frqtab[noparse][[/noparse] ] array.
To control the harmonics of a FM or PhaseMod- synthesis we need a sine like waveform from the oscillators. For that I use not the rom-sine-table, but take just the absolute value of the phase register. As you see in (3) the absolute value of a Saw-wave is a Triangle wave, and this is near to a sine. The Propeller has Assembly instructions like ADDABS which does an addition and a waveform translation in one cycle!.
In every 32 kHz periode only 1 envelope is calculated, but every time for another voice. So after 10 periodes the envelopes for all voices are done. Because the envelope is a slowly changing curve the resulting sample fequency of 3.2 kHz is good enough.
Comments
Cheers!
Paul Rowntree
I don't see an advantage to that. Especially because an EEPROM only can be written so many times. There may be some speed advantage, but the writing issue is a bigger one for me.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
Have I missed something here?
Cheers!
Paul Rowntree
Paul,
I consider several years of viable use a problem. I think using up an eeprom just to get around the multi-read of an SD card not smart. I would rather stick with the format 0 than to burn up an eeprom.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
> - why decay and release time values are the same? Maybe it would be great having two different values.
> - why not adding an LFO to modulate DCA and or PM?
The synthesizer engine is designed to use a minimum of parameters, to get as much voices in 1 cog as possible. For a midi
file player the number of voices is more important than a voice architecture which allows detailed modelling of the sound.
When 20 voices plays, you can't hear if the release is a bit shorter than the decay time, or if there is an LFO modulation.
The cog ram is very limited, and the current implementation uses the whole ram (not 1 register/instruction left free).
It is possible to make a more advanced synthesizers, with lower voice count. Perhaps one voice in one cog and with external
analog filter hardware. Sometimes I dream of this, but had not the time so far...
What I miss most in the current design are the continous controllers, like expression and pitch bending. Many midi files uses
such controllers, and this results in wrong notes and wrong mixing balance of the voices.
Andy
Writing to the tracks to an EEPROM would be possible, but only for short midi files. But I have here files up to 400 kByte, to
big for an EEPROM.
As I said before, it will be possible to play a file in format 1, with a lot of effort on the SD card driver. One way will be, to have the midi files with contiguous sectors, and access the tracks with low level sector reads.
But I really don't see, why it is so important to play Format 1 files. Converting the files to format 0 is easy, and makes the software so much simpler.
The format 1 is mainly ment as a portable file format between sequencers. The tracks are separated in the file so that another sequencer can reconstruct the track structure. Playing the file is always a mix down to one midi stream, which makes the sequencer in realtime while playing.
Andy
We're all going to need to adopt an add-on RAM option like
that of the SRAM interface by Ray, or Andre. Like those many
who are using an SD interface, this would solve many of the
problems like this one. Andy if you had some memory you
could spool it off to, problem with playback of midi 1 would
be pretty much solved.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
Finally got a chance to set this up.. VERY NICE.
Here's the exact changes for adjusting Media Player (and others) for proper Midi output.
START-->Control Panel-->Sounds and Audio Devices-->Audio Tab
Pull down the "Midi Playback Device" and choose the Roland device.
Great Job Andy!
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
with some sort of color display. Attached is a version of "Midi Expander" with
a sort of multicolor display player. (ie: simple lightshow)
It brought a smile to my face, so I thought I'd share it. I thinking I might incorporate
this into some sort of PropDOS midi player with a fun display.
Follow Andy's instructions above for setting up the Roland Serial Driver for this.
BTW, there's a pretty nice midi site at www.midimole.com
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
I tried a little bit to play arround with your synthesizer object, but I do not realy understand the parameter list of your methods. Can you explain how I can generate the different instruments voices? I don't know the midi parameters, so I couldn't unterstand what paramter the functions need. Here is my little test program with which I could generate different pitches ( in your term notes ). But how could I alter the instrument?
MIDI has 16 different channels (0..15), and every channel can play another sound. The General MIDI standard defines 128 sound numbers, look in the table inside the object to see the assigned Instruments. If you set a sound for a channel, then all notes sent with noteOn to this channel play this sound.
Every note you play needs also a noteOff to stop the the note. You can see the noteOn as pressing a key on a keyboard and noteOff for release the key. If you only use noteOn, it's like pressing many,many keys and never release theme.
Channel 10 is special in that it is for the drums, and every note plays another sound. Again the table shows the drum sound numbers.
Be aware that MIDI defines the number range different from the real passed number: The instruments 1..128 are in reality 0..127, and the channels 1..16 are 0..15 (to play drums you must pass 9 as channel number).
There are also methodes in the object to set the Main volume and the panorama position per channel, both with values from 0..127.
If you want change the instrument sounds itself, then you have to edit parameters in the table of the object, this is not possible with MIDI commands.
Andy
I made some observations: in the first example, The sound seems to alter a little bit during the 50 repetitions.
I don't know how to interpret 'velocity': is it attack, decay? A value of 500 seems to give the maximum loudness, but sometimes also a little noise.
if I change to Channel 9 ( drums ) it seems not to work. ( at least in the example code )
chris
Yes it seams that the voices of the second cog play louder than the first cog. So after every 10 notes the sound change a little bit.
Velocity defines how hard a note is played. Soft=0...hard=127. Its called velocity or dynamic, because a synth keyboard measures the time between the released state of a key and the full pressed state. If you play harder, the key is faster pressed down, and therefore velocity is higher.
A high Velocity value makes the sound louder and also changes the harmonics a bit for some sounds.
It would help you if you study the MIDI specification a little bit:
en.wikipedia.org/wiki/General_MIDI and the links there.
Try the following examples for drums and chords: (copy it in your test loop)
Andy
I wanted an easy way to experiment with creating different sounding instruments so I wrote this program.
Displays all of the variables for an instrument on the screen, allowing you to adjust them up/down
and try them out with a simple scale. Starts out with Grand Piano settings, then you take it from there.
{Personal favorite is dropping the PhaseMod to 0}
I'm hoping to come up with some nice 80's synth sounds this way. [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
thanks for your help. As attachement, my beginners test programm.
Do you know, where I can find some free midi files in the net? ( yes I know google, but since midi files are used in cell phones, its very difficult to find some example midi files for free ). In earlier days I hat a 3,5inch disk with a lot of midi files for my Atari ST.
I'm thinking about some simple compressing algortihm which conpresses the midi-file to some microcontroller readable attachement ( C include file or spin data ).
It seems to me as if midi files are easy to compress. And the Linus Akkeson demo "turbulence" shows, that there a lot of music can be stored in the propeller. Probably it would be good to write a little java programm to generate the midi compressed resource.
Is anybody out there who knows if such a programm exists? At least Linus has done one.
chris
There are a lot at ClassicalArchives.com. I haven't been to the site in a while. I just took a quick look and it looks like they are more heavily into MP3 these days, but there are still MIDI files if you look closely.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
links:
My band's website
Our album on the iTunes Music Store
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Here is a search engine for free MIDI files:
www.midisite.co.uk/
Some post back OBC has recommended this site, and I have found some good files there:
www.midimole.com/
Cluso99
The Audio circuit was ment as Line out. I use it with a pair of activ PC loudspeaker boxes.
But because you have asked, I tried it out with 2 Earphones from an old Walkman and an MP3 player.
I was surprised that it get a clear sound with one of the earphones, only a bit quiet (definitly no ear damage possible[noparse]:)[/noparse]
The other one has a sound like thru a phone, but also not really bad.
One problem of the circuit is the missing decoupling C, so you have a lot of DC current thru the coil of the headphone.
Attached is version of the Audio out which should sound much better, but I have it not tried so far...
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Still playing with the object. (Yes, I'm hooked!)
Question: Can you give an example of how to hold a note as long
as bit is switched? I'm using some PING))) sensors with this object
to create a very funky synth. At the moment I'm getting pauses
in the note which sound funny doing an organ or wind intrument
with this object.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
You can add as many bit tests you need in the repeat loop. Every bit can play another note, also on another channel, to get
different sounds.
(This is not testet! )
Andy
Thank you.
[noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Meh. Nothing here, move along.
Now that rokicki and lonesock have sdcard reads over 2MB/second (at 100MHz clock), maybe it would be possible for type1 midi files now?
Thanks,
Doug
I actually tried it out just now, and I am very impressed. I didn't know the propeller could do this! Great work Andy!
Doug
Yes with the new FSRW a Format 1 player should be doable, not because it's faster, but because the driver allows to read several files at the same time. So it should also be possible to read the same file at several positions with the right number of instances of the FSRW object.
I just have not the time, to do it now. And I know, if I program something which produces music, this needs a lot of time, because every time a part works, I always get lost in hearing music instead of continue programming.
Andy
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
Could you explain, in a few words, the basic principle how you managed to implement as many as 20 oscillators (plus envelope) in one cog that has only two hardware timers? How do you get the frequencies right? And are you using the Propeller's built-in sine table?
I will try to explain it:
The cog-counters are not used for the oscillators, they are used for the DACs (in DUTY mode).
The whole cog has a single loop which runs exactly with a rate of 32 kHz. The code in this loop is splitted in 12 time slices.
10 time slices calculates the 10 voices, 1 slice calculates a single envelope, and the 12.th slice calculates the mixing of the 10 voices, limits the max. and min. value and writes the samples to the DACs.
A voice has 2 oscillators. The Oscilllators are made with the DDS (Direct Digital Synthesis) principle, you will find a lot of informations in the NET about that, but here is my short explanation:
You have a phase and a frequency register. The freq.register is added to the phase register once every 32 kHz. So the phase-accumulator increases with a rate depending of the value of the freq.register. Because the register has a limited size (32bit) the phase register rolls over after a while (see (1) in my picture). The phase is a signed register, so the roll-over occures from $7FFF_FFFF to $8000_0000 (the most positive to the most negative value). The frequency off the roll overs is the frequency of the oscillator that you will hear. And because the value of phase is continuously increasing between the roll overs, you get a Sawthooth waveform. To produce higher or lower oscillator frequencies you need just to vary the freq-register value (2).
The right freq.register values for the notes are precalculated in the frqtab[noparse][[/noparse] ] array.
To control the harmonics of a FM or PhaseMod- synthesis we need a sine like waveform from the oscillators. For that I use not the rom-sine-table, but take just the absolute value of the phase register. As you see in (3) the absolute value of a Saw-wave is a Triangle wave, and this is near to a sine. The Propeller has Assembly instructions like ADDABS which does an addition and a waveform translation in one cycle!.
In every 32 kHz periode only 1 envelope is calculated, but every time for another voice. So after 10 periodes the envelopes for all voices are done. Because the envelope is a slowly changing curve the resulting sample fequency of 3.2 kHz is good enough.
I hope this makes it a little more clear
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm