mp3 hassle – automatically setting buffer size from import!

May 16, 2009 at 4:15pm

mp3 hassle – automatically setting buffer size from import!

Hi all,

Ive been making a pretty good mp3 player by using buffer~, info~ and play~.

Ive noticed an issue with import and read. Firstly the read function must be used before an import otherwise the buffer will not load the audio. Once read had been used with a .wav file I can then import a mp3 into the buffer. The buffer will then automatically adjust to the correct length for the mp3. If I then use a read function with wav after the buffer will remain at the length of the mp3 previously loaded. This only happens when switching from wav to mp3 and back again.

Does any one know how to get round this, without having to manually enter the info, thanks in advance.

Ahhhhhhhhhhhh! MP3 sucks.

#43951
May 16, 2009 at 5:08pm

ahhh sod it!

some one please make it betterr. LOL

– Pasted Max Patch, click to expand. –

thanks!

#157847
May 16, 2009 at 5:45pm

Use “replace” instead of “read” to automatically resize the buffer to the length of the audio file. If you look at the [buffer~] reference page it will explain all the different messages you can send to the object.

lh

#157848
May 16, 2009 at 5:48pm

Please take a look at the buffer~ entry in the manual, check the message description for read and import.

While the help patches are a good start, you should always refer to the manual for detailed behaviour if things does not work out as you expected.

#157849
May 16, 2009 at 5:51pm

Simultaneous post Wink.

#157850
May 16, 2009 at 5:53pm

High five!

lh

#157851
May 16, 2009 at 5:58pm

I only noticed that command after posting. And yes it does work perfectly thanks very much. Will look closer next time.

Whilst u are all here on the subject. I intend to try and make a audio list slash library. How would I approach trying to detect a format of file, so I could somehow automatically use replace or import depending on format.

Also can I get the length of file without adding to a buffer then using info~?

Am I using the best method for mp3 functionality also. Is grove better? Or maybe spigot~ via the quicktime stuff? Any opinions are welcome.

Just wanna consider the best options really.

Thanks peps.

#157853
May 16, 2009 at 6:08pm

RabidRaja, thanks very much. Just what I needed. I have been using some over complicated ways to achieve what u did with a few objects!

Thanks very much.

#157855
May 16, 2009 at 6:10pm

Here’s a method that uses [regexp] to check to see if the filename ends in “.mp3″ if it does then it is formatted for the “import” message and if not for the “replace” message.

lh

– Pasted Max Patch, click to expand. –
#157856
May 16, 2009 at 6:22pm

Keep em coming, some great techniques. Thanks!

#157857
May 17, 2009 at 3:23am

hi,

Is there a way to filter only .mp3 files?

Thanks

Luis Marques

#157858
May 17, 2009 at 4:42am

The example I posted above will show only .mp3 files from the middle outlet.

lh

#157859
May 17, 2009 at 4:45am

hi,

yes, that does do that. but in objects like “folder” or “umenu”?

Thanks

Luis Marques

#157860
May 17, 2009 at 4:50am

Look at the help file and you will notice you need the filetype message. These can be found in cycling ’74 > init > max-fileformats.txt or for individual files by looking at the right outlet of [dropfile].

lh

#157861
May 17, 2009 at 4:54am

i’ve already done that… and nothing appears in the right outlet from dropfile object when i drop an mp3 file, and there is no mp3 code in max-fileformats.txt. I hope there’s a new way to do that…

thanks

Luis Marques

#157862
May 17, 2009 at 4:57am

I just tried a few.p3 files and got “MP3 ” and “MPG3″ as the results, perhaps give those a try.

lh

#157863
May 17, 2009 at 4:58am

OK.

i will.

Thanks

Luis Marques

#157864
May 17, 2009 at 5:07am

hi,

i tried those mp3 codes, but only work whit some of them, not all.
I dropped my iTunes Library to object folder, and have luck on a few albums…

Thanks for your time,

Luis Marques

#157865
May 17, 2009 at 12:16pm

Did you try the sfinfo~ object? Not sure if it works for compressed files.

#157866
May 17, 2009 at 6:20pm

Dam! That is rubbish. Same problem here too.

#157867
May 17, 2009 at 6:36pm

This is particularly disappointing!

#157868

You must be logged in to reply to this topic.