First time here? Check out the FAQ!
x

How can I place markers in a wav or aif using smalltalk?

0 votes
225 views
Hi there,

We want to simplify the process of making ROMs where many samples are stored into a single file.  So assuming we already rerecorded the concatenated samples and we know the sample position I need a way to open the sample (or ROM), place the markers and save it again. I was thinking about a tool to do that of course.

In the smalltalk appendix I only see the markers message for reading markers, but I guess there is a way to write them as well?

Thanks!
asked May 23, 2016 in Capytalk & Smalltalk by kymaguy (Virtuoso) (10,580 points)
Related to this development idea me and Gustl are working on at the NeverEngine Labs.... can we read the sample value from an exact sampleframe in an audio file using Smalltalk/Capytalk ?

1 Answer

+1 vote
 
Best answer

Here is a snippet of Smalltalk code to save the markers:

| markerDictionary sf |

markerDictionary := Dictionary new.
markerDictionary at: 'marker1' put: 150.
markerDictionary at: 'marker2' put: 1000.

sf := 'test.wav' asSamplesFile.
sf markers: markerDictionary.
sf updateHeader.

Each key in the Dictionary must be a unique string and each value must be an integer sample number (0 indicates the first sample in the file).

Its always a good idea when programming to make backups of your files before modifying them, just in case anything goes wrong ;)

answered May 24, 2016 by ssc (Savant) (119,300 points)
selected May 24, 2016 by kymaguy
nice! thanks ssc!
With this code snippet (thanks for posting SSC) that integer sample number indicates the position in sample frames of the marker, right? Do we need to keep them ordered? Is this valid for 'wav' and 'aif' ?

What else can we store in the header and how?
No, the example is defining them in ascending order, but a Dictionary is not ordered — you can random access it by key.
@ssc: I second cristian's question: what else can we store in the header and how?
@cristian: it's valid for both wav and aif
...