22 May '13 - 19:31 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: save mp3 to specific location  (Read 727 times)
pjuegos
Posts: 21


« on: 13 Apr '12 - 18:39 »
Reply with quoteQuote

Hi all,

I have a small problem when trying to encode an mp3...

If I use BASS_Encode_Start as follows, it will save perfectly the mp3 file as "output.mp3" in the working directory

   DWORD dummy=BASS_StreamCreate(info.freq, info.chans, BASS_STREAM_DECODE, STREAMPROC_DUMMY, 0);
   HENCODE BASS = BASS_Encode_Start(dummy,"lame --alt-preset insane - output.mp3" , 0, NULL, 0);
        BASS_Encode_Write...


   The problem lies when I change the path to something else, such as:
        HENCODE BASS = BASS_Encode_Start(dummy,"lame --alt-preset insane - c:/output.mp3" , 0, NULL, 0);

I tried all combinations of c:/ ,  c:// ,  c:\ ,  c:\\

Any idea of what is going on?

Thanks!!!!

pj
Logged
Wishmaster
Posts: 124


« Reply #1 on: 13 Apr '12 - 21:28 »
Reply with quoteQuote

try 

BASS_Encode_Start(dummy, "lame --alt-preset insane - " + "c:\output.mp3" , 0, NULL, 0);
Logged
AName
Posts: 20


« Reply #2 on: 13 Apr '12 - 22:53 »
Reply with quoteQuote

LOL Wishmaster, your post shows either an extreme lack of understanding of coding or you haven't read the OP's post very well. He's already tried c:\.
Logged
Wishmaster
Posts: 124


« Reply #3 on: 14 Apr '12 - 01:15 »
Reply with quoteQuote

hi. my understanding in coding is better than you think! I do not know how it is with other languages, I write in delphi!
I had the same problem as you do @pjuegos.

you should take a closer look at the line of code that I had posted before.

I do no longer use the *.exe encoder only .dll's but

exemplar of a previous project
           (* Create Encoder Channel *)
              Flag:= 0;
              Flag:= Flag or BASS_ENCODE_PAUSE {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF} or BASS_ENCODE_AUTOFREE;
             case FEncOption.FLACOptions.BitsPerSample of
              8  : Flag:= Flag or BASS_ENCODE_FP_8BIT;
              16 : Flag:= Flag or BASS_ENCODE_FP_16BIT;
              24 : Flag:= Flag or BASS_ENCODE_FP_24BIT;
             end;


              fStr:= PChar(' -f --compression-level-' + IntToStr(FEncOption.FLACOptions.Compression) + ' - -o ');

             // FEncOption.FLACOptions.Encoder  =  c:\subfolder\123\haha\flac.exe
             // fStr = cmdline
             // FFilename =  c:\subfolder\recording\output.flac

              ChanEnc:= BASS_Encode_Start(ChanMix, PChar('"' + FEncOption.FLACOptions.Encoder + '"' + fStr + '"' + FFilename + '"'), Flag, nil, nil);
             if ChanEnc = 0 then
              begin
               Error();
               Exit;
              end;


it is at least in Delphi
- '"'C:\directory\Filename.mp3'"'
not
-  C:\directory\Filename.mp3
 


« Last Edit: 14 Apr '12 - 01:24 by Wishmaster » Logged
AName
Posts: 20


« Reply #4 on: 14 Apr '12 - 01:37 »
Reply with quoteQuote

My point was that the code in your first post is basically the exact same as the OP's code. The only problem that occurs in C# with file paths is you have to use "\\" instead of "\" because \ is an escape character.

Now, this is what it says in the .Net documentation:

Quote
cmdline
Type: System..::..String
The encoder command-line, including the executable filename and any options. Or the output filename if the BASS_ENCODE_PCM flag is specified.

I don't think that the string itself is the problem. I suggest you look into using parameters with LAME. Maybe there's a special way you have to pass the file path to it... From my previous usage of command prompt, I would say it might be something like "-p C:/output:, etc. That's all I can say.
Logged
Wishmaster
Posts: 124


« Reply #5 on: 14 Apr '12 - 02:02 »
Reply with quoteQuote

LAME 32bits version 3.97 (http://www.mp3dev.org/)

usage: c:\....\Lame.exe [options] <infile> [outfile]

    <infile> and/or <outfile> can be "-", which means stdin/stdout.

RECOMMENDED:
    lame -V2 input.wav output.mp3
Logged
Ian @ un4seen
Administrator
Posts: 15269


« Reply #6 on: 16 Apr '12 - 14:36 »
Reply with quoteQuote

   The problem lies when I change the path to something else, such as:
        HENCODE BASS = BASS_Encode_Start(dummy,"lame --alt-preset insane - c:/output.mp3" , 0, NULL, 0);

I tried all combinations of c:/ ,  c:// ,  c:\ ,  c:\\

In C/C++, you would use "c:\\". Regarding the problem that you're having, perhaps it is a permissions issue, ie. you're not allowed to write in the target directory. As writing to the working directory is known to work, what happens if you provide the full path to that directory? If it contains spaces, the filename should be enclosed in quotes, like this...

        HENCODE BASS = BASS_Encode_Start(dummy,"lame --alt-preset insane - \"c:\\my path\\output.mp3\"" , 0, NULL, 0);
Logged
pjuegos
Posts: 21


« Reply #7 on: 17 Apr '12 - 14:05 »
Reply with quoteQuote

Hi,

thanks to all for you help!

Ian, I tried your call to BASS_Encode_Start and it works perfectly!

thanks a lot!

pj
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines