Hardware wavetable on an arduino

Please remember the terms of your membership agreement.

Moderators: valis, garyb

User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Hardware wavetable on an arduino

Post by Neutron »

I need some 256 value comma delimited text files made from various synth waveforms (I have manually made saw, square and so on but i need things like sine with second harmonic, third harmonic and some of those cool waldorf ones.)

the files would look like this:

sintable
127,130,133,136,139,143,146,149,152,155,158,161,164,167,170,173,
176,179,182,184,187,190,193,195,198,200,203,205,208,210,213,215,
217,219,221,224,226,228,229,231,233,235,236,238,239,241,242,244,
245,246,247,248,249,250,251,251,252,253,253,254,254,254,254,254,
255,254,254,254,254,254,253,253,252,251,251,250,249,248,247,246,
245,244,242,241,239,238,236,235,233,231,229,228,226,224,221,219,
217,215,213,210,208,205,203,200,198,195,193,190,187,184,182,179,
176,173,170,167,164,161,158,155,152,149,146,143,139,136,133,130,
127,124,121,118,115,111,108,105,102,99,96,93,90,87,84,81,
78,75,72,70,67,64,61,59,56,54,51,49,46,44,41,39,
37,35,33,30,28,26,25,23,21,19,18,16,15,13,12,10,
9,8,7,6,5,4,3,3,2,1,1,0,0,0,0,0,
0,0,0,0,0,0,1,1,2,3,3,4,5,6,7,8,
9,10,12,13,15,16,18,19,21,23,25,26,28,30,33,35,
37,39,41,44,46,49,51,54,56,59,61,64,67,70,72,75,
78,81,84,87,90,93,96,99,102,105,108,111,115,118,121,124

has anyone got an idea of a program that could do that?

whats it for? well i have made a wavetable oscillator from an arduino. it plays exact MIDI notes and everything.
I am just messing around with it, but i have memory space left for lots more wavetables.

they are not multiple page wavetables like waldorf, just playing single cycles.
(dont worry this is not yet another project, just messing around) FOR NOW :D
Last edited by Neutron on Fri Jan 29, 2010 9:54 pm, edited 1 time in total.
User avatar
astroman
Posts: 8410
Joined: Fri Feb 08, 2002 4:00 pm
Location: Germany

Re: anyone know how to generate comma delimited text ftom a wave

Post by astroman »

well, I never done anything with .wav files yet, so I just made a small one with Wavosaur...
the waveform seems to start at a defined position and it ends before the text SAUR.
I could make a small app that slides a 256 sample 'window' over the waveform, scales down to 8bit (or whatever) and writes the file.
It could look for zero points and smooth the edges, if thats required.

cheers, Tom
petal
Posts: 2354
Joined: Sun Sep 15, 2002 4:00 pm
Location: Copenhagen
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by petal »

I'm pretty sure you could do this with Pure Data.

You would have to do the programming your self, but I'm 99% positive it can be done:

1. load the waveform in a table
2. read each each sample from the table, put it in a list using one of the list functionalities.
3. write the list to a text-file

All these fuctionalities are dealt with in the toturials that coems with Pure Data (which is free), and then you'll also have a valuable tool for your Arduino afterwards :)

Cheers,
Thomas
tgstgs
Posts: 526
Joined: Sun Jan 15, 2006 4:00 pm

Re: anyone know how to generate comma delimited text ftom a wave

Post by tgstgs »

export as txt file from wavlab;
import in acces or whatever to modify;

csv file vibes

edit:
the more i think about . .
im not into this but hasnt this databasetable apllications the possibility to fill the data with functions?
so you could use every function mathmen ever thought of?
User avatar
astroman
Posts: 8410
Joined: Fri Feb 08, 2002 4:00 pm
Location: Germany

Re: anyone know how to generate comma delimited text ftom a wave

Post by astroman »

funny... i was thinking math functions the first place
then it would be just to 'copy' an Excel column and replace Returns by Commas in an editor

so I assumed he wanted data from existing .wav files

cheers, Tom
tgstgs
Posts: 526
Joined: Sun Jan 15, 2006 4:00 pm

Re: anyone know how to generate comma delimited text ftom a wave

Post by tgstgs »

excel should be able to export *.csv files;

------
*.wav

all chunks start with a name then the size;
all info is in the headerchunk;
datachunk starts with long DATA;
next is a long datasize;
there could be additional chunks before or after the datachunk;
--

good vibes
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

it seems like the first thing to do is figure out what frequency has exactly 256 samples at the applications sample rate.

I have found something here that might work.

http://www.eng.yale.edu/ee-labs/morse/a ... ptions.htm
User avatar
astroman
Posts: 8410
Joined: Fri Feb 08, 2002 4:00 pm
Location: Germany

Re: anyone know how to generate comma delimited text ftom a wave

Post by astroman »

so you want to take the full algorithmic approach and calculate all the waveforms ?
I don't even have the glimpse of an idea how to do that in Excel :-? :lol:

as mentioned I made a small 8 bit example file and looked at it with a hex editor.
Everything seemed neat and linear, but don't judge a book by it's cover, and that's just the 'simple' version...
at least you got me shift my butt and eventually look into a physical audio file :D

cheers, Tom
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

about half way down is a "wave 2 csv" program
im giving it a try

well it looked promising apart from being a windows 65 era program and not actually working. "this file is already open" is all i could get it to say.
User avatar
iSiStOy
Posts: 713
Joined: Mon Jun 20, 2005 4:00 pm

Re: anyone know how to generate comma delimited text ftom a wave

Post by iSiStOy »

tgstgs wrote:edit:
the more i think about . .
im not into this but hasnt this databasetable apllications the possibility to fill the data with functions?
so you could use every function mathmen ever thought of?
Yep. With SQL Server or Oracle free db versions, you could even think of creating views, cursors or whatever temp tables with SQL language and applying some included or specially compiled library functions (C++, C#, whatever).
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

I ended up getting the values ot of wavelab, but they are positive and negative so i had to resample over and over till the wave segment was exactly 256 samples, translate them in excel. then decide i dont like that one and start over. all together almost as painful as manually entering them.

I have 8 in there now, and i can switch them on the fly, so i can have the wavetable change depending on velocity, envelope value, a knob, or random.

it is way too much fun, i think i can make a very respectable mono bass synth with (maybe 2 of) this and a filter chip.
need to figure out the standard "303" way of doing slides now (overlapping notes)

i have on just one arduino mega:
play wavetables pitch accurately
recieve MIDI notes and velocity (and whatever else i need later) [with external opto isolator chip]
attack decay envelope
modulate wavetable
modulate volume
detune knob (important if i run 2 of them)

and more to come, i have only used up 1 1/0th of the program and data memory but the maximum amount realtime stuff will depend when the envelopes start to get slow.
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

Of all things, 3ds max maxscript :wink: (slow day at work!). with this one i can make some waveforms by adding harmonics(+ or -). and it prints the properly formatted table right to the maxscript listener for copypasta into the arduino IDE.

now the osc works by taking 2 selected waveforms and morphing between them, poor mans waldorf :D
waveform.jpg
waveform.jpg (302.01 KiB) Viewed 4230 times
User avatar
iSiStOy
Posts: 713
Joined: Mon Jun 20, 2005 4:00 pm

Re: anyone know how to generate comma delimited text ftom a wave

Post by iSiStOy »

The hardcore way! real experiment! Do you plan combining all these tools calculations for an additive synthesis purpose "soon" ?
That's a great thing to follow, imho!!!
Do I understand correctly that you're putting this into some real chips (arduino, what is that?) afterwards?
David
Posts: 733
Joined: Wed Jan 09, 2002 4:00 pm
Location: Modular IV

Re: anyone know how to generate comma delimited text ftom a wave

Post by David »

it's a neat little open source prototyping board
http://www.arduino.cc/
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

Here is one playing wavetables from MIDI.
IMG_0229.jpg
IMG_0229.jpg (239.96 KiB) Viewed 4190 times
Knobs are
wavetable 1
wavetable 2
mix
A
D
S
R
Lfo speed
Lfo depth

they are potentiometers, but i am going to change that to 8 encoders and an LCD (otherwise i just keep adding more and more potentiometers and run out of space :)

the sound is quite good considering it is just coming from a PWM pin. i am getting a little DAC for it though

I put in some of the wavetables made with Maxscript last night and they sound very good.
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: anyone know how to generate comma delimited text ftom a wave

Post by Neutron »

i finally inputted it to the computer rather than a speaker, im using a very bad single pole filter resistor and capacitor filter through a potentiometer (10k in to 20k pot with 47nf capacitor) with this program though it is very easy to change to 16 bit for DAC output and probably increase the sample frequency. i have a fine whine or dull sound with the weak filter. (i dont have an in between capacitor) 47nf or 10nf

a proper opamp cutoff filter will help, however i am still really happy with it, especially detuning one of the wavetable reads so when i fade between them there is a bit of phasey phatness.

from experiments today i can also do "supersaw" up to 7 (actually center and 3 detunes in different direcions) saws or polyphony up to 4 notes (maybe more without envelope and LFO on board) hopefully there is enough program space to do all options

but hey it sounds great all i wanted to do was make an osc for my SSM2044 filter and make a little bass synth and its coming along better then i could imagine

I will probably get anpther ATMEGA chip and set it up just to recieve frequency info and just be a real oscillator by itself then i could probably have 8 note polyphony
(i did not even start out trying for polyphony, just super wavetable osc , but hey what can yo do when you are having fun :) )
Last edited by Neutron on Fri Jan 29, 2010 11:14 pm, edited 1 time in total.
User avatar
iSiStOy
Posts: 713
Joined: Mon Jun 20, 2005 4:00 pm

Re: Hardware wavetable on an arduino

Post by iSiStOy »

Its your own DIY little synth beast. Do you plan on using some real analog osc instead of wavetables?
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: Hardware wavetable on an arduino

Post by Neutron »

i just wanted an osc for the SSm 2044 filters that was better than the osc in the bass line type synths. easy

to do analog might take a bit of tweaking but i could output a voltage to a DAC which would control a VCO, sort of the same way i intend to control the SSM2044 filters with this.

originally it was all about the square and the saw, with the lovely SSM2044 filter sound all the other stuff is just bonus.

dual reading accurate wavetable froma dinky little arduino..im sold and im trying to use it to its max

when i fade from, say square to sine it sounds jut like a filter sweep. it has worked way better than expected

i got 10 SSM2044 and im going to do a few differnt things with them. i love their sound.
maybe analog only mono synth but not high on the list :)
User avatar
iSiStOy
Posts: 713
Joined: Mon Jun 20, 2005 4:00 pm

Re: Hardware wavetable on an arduino

Post by iSiStOy »

Do you mean sthg like this?
http://www.youtube.com/watch?v=CWfQRRoFmDU :D

You would chain several of them in parallel or series? I suppose you want to use it for trying some music :)
User avatar
Neutron
Posts: 2274
Joined: Sun Apr 29, 2001 4:00 pm
Location: Great white north eh
Contact:

Re: Hardware wavetable on an arduino

Post by Neutron »

yes thats the same chip :)
ill put one on this

:)

http://www.youtube.com/watch?v=Hdo-vNCDg_c

and i have thought of a way to make at least square/pulswidth and triangle which is exactly in tune with only minimal external components so it will have some analog osc as well :)
Post Reply