Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to split MP3 file into many?
Message
 
 
À
21/05/2007 13:07:23
Information générale
Forum:
Windows
Catégorie:
Informatique en général
Divers
Thread ID:
01226405
Message ID:
01227386
Vues:
13
>>>
>>>I agree with your choice of TotalRecorder. It's also one of the few that I found that can do automation.
>>
>>If you don't mind, could you share what kind of automation you do with TotalRecorder?
>
>
ts = SECONDS()
>*tra = CREATEOBJECT("TotalRecorder.Application")		&& not needed - for user interface
>trsf = CREATEOBJECT("TotalRecorder.SoundFormat")
>trd = CREATEOBJECT("TotalRecorder.Document")
>trd.Open("c:\testts2mp3.wav")		&& Open the source file
>trsf.FormatType = 0		&&  0 = FormatTag	1	PCM (uncompressed sound) , including High Quality
>				&&			2	Microsoft ADPCM
>				&&			3	PCM IEEE float 32 bit
>				&&			34	DSP Group TrueSpeech(TM)
>				&&			85	MPEG Layer-3
>				&&  1 = Ogg Vorbis format FormatTag not used
>				&&  2 = Format Tag	353	Windows Media Audio V7
>				&&			354	Windows Media Audio 9 Professional
>				&&			355	Windows Media Audio 9 Lossless
>				&&			10	Windows Media Audio 9 Voice
>				&&  3 = FLAC format FormatTag not used
>					
>trsf.FormatTag = 85		&& MP3		&& Set the new format
>***trsf.FormatTag = 10		&& WMA			&& Set the new format
>* not all combinations available
>* See C:\InstalledUtilities\TotalRecorder\Automation\TotRecAuto.hlp
>*	SoundFormat.Validate method for details
>* For MP3 format, you must set FormatType = 0, FormatTag = 85,
>*	and the Channels, SamplesPerSec, BitrateMin, BitrateMax, and BitrateNom properties
>*	depending on the BitrateType.
>* For Windows Media Audio format, you must set FormatType = 2. The FormatTag,
>*	Channels, SamplesPerSec, BitrateType, BitrateNom and WMAQuality properties
>*	should be set depending on the BitrateType.
>*
>trsf.Channels = 1			&& 1/2 mono/stereo
>trsf.SamplesPerSec = 8000	       && kHz 8000/11025/12000/16000/22050/24000/32000/44100/48000
>trsf.BitrateNom = 16			&& bps 4/5/6/8/16/18/20/24/32/40/48/64/80/96/112/128/160/192/224/256/320
>***trsf.BitrateType = 3		       && WMA 0 (Quality Managed bit rate) or 3 (Constant Bit Rate) only
>***trsf.WMAQuality = 0			&& not used for BitrateType=3 (1-100)
>trsf.Validate()			&& Make sure it's a valid combo
>?trsf.valid
>IF trsf.Valid
>***  trd.SaveAs("c:\test2.mp3",trsf)		&& Save the document with the new format 1/8000/16
>*  NOTE  automation won't save if the UI version is running!!!!
>***  trd.SaveAs("c:\test29v.wma",trsf)		&& Save the document with the new format
>  ? "File saved"
>  ?trd.Saved
>ENDIF
>*tra.Quit()
>tra = NULL
>trd = NULL
>trsf = NULL
>te = SECONDS()
>? te-ts
>
>Sorry, but this code was last used to convert a TrueSpeech format WAV to WMA 9 Voice format. We had done MP3 before, and I *think* I've commented out the code you don't need.

Thank you very much for sharing the code. I have never worked with sound files in my applications, and was curious what kind of projects can be done with sound files.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform