Byte data extraction and interpretation from a WAVE sound file

Hello,
I'm trying to extract the signal data from a WAVE-file for further processing. Suppose the WAVE-file is in 16 bit/stereo format - then I get (8 bit) low-byte and (8 bit) high-byte for the left channel first, and then the low- and high-order bytes for the right channel (I hope I've got it right this far).
Now since I'm interested in doing some frequency analysis on the signal, I need to have the amplitudes for every sample, but since each byte is signed I can't just compose the complete amplitude value from the two bytes for each channel. A simple way to solve this would be (I think) to check if a byte is negative, and if it is, store the absolute value of the byte + 127 in an integer. For example, the byte 11111111 would be interpreted as -128, but taking the absolute value and adding 127 produces 255 which would be the maximum "unsigned" value for an 8 bit binary number.
This seems like a quite "ugly" solution to me, and I don't really like ugly things. I haven't worked that much with binary math in Java, and my general knowledge on the subject is not very thorough in the first place. I would be very grateful for any suggestions.

Ok, I went to buy some food and came up with another solution:
Suppose I have a sample from one of the channels in my byte array "signal" and I want to compose a (signed) total amplitude of the two bytes in the array. Code:
byte[] signal = ... ; //Get the data
int amp = 0x0000;
amp = ((signal[1] & 0xFF) << 8) | (signal[0] & 0xFF);
Here I assume that the data is aquired in little-endian format. If you have a better solution, please let me know.

Similar Messages

  • Copy data models and reports from BW 3.1 to NW 2004s

    Hi experts,
    Our client has two BW servers: BW 3.1 and BI 7. BW 3.1 contains lots of data models and reports. And the BI 7 server is newly installed.
    Now we want to copy these data models and reports from BW 3.1 to the new BI 7 server. Are there any solutions for this?
    Thank you very much in advance.

    Hi Frank,
    Sounds like a cross version transport is needed.
    This is a solution we have used to do what you want to do:-
    Create and release a transport as per normal.
    Copy and transport the files from the source system (BW 3.1) e.g /usr/sap/trans/data & /usr/sap/trans/cofiles to the same folders on the target system.
    Basis help is needed here.
    From here onwards using stms_import should help you in the normal manner.
    Works a treat.
    Have transported the following all correctly appearing as 3.x data models in NW2004s.
    DSO objects.
    Cubes
    Transfer/Update rules
    Reports.
    Cheers,
    Pom

  • Which programs if any can extract the image from existing QTVR pano file?

    Which programs if any can extract the image from existing QTVR panorama files that were created with one image?
    Any ideas?
    Thank you

    Unless you can find an open source ODBC driver for SQL Server that runs on Solaris (and I wouldn't be overly hopeful there) Heterogeneous Services would require that you license something-- a third party ODBC driver, a new Oracle instance, or an Oracle Transparent Gateway.
    As I stated below, you could certainly use SQL Server's ETL tool, DTS. Oracle's ETL tools would require additional licensing since you're just on 9.2. You could also write a small application (Java or otherwise) that connected to both databases and transferred the data. If you're particularly enterprising, you could load the SQL Server Type 4 JDBC driver into Oracle's JVM and write a Java stored procedure that connected to the SQL Server database via JDBC, but that's a pretty convoluted approach.
    Justin

  • How to move the data of a table from sqlplus to XML file

    Hi,
    Could you pls guide me how to move the data of a table from sqlplus to XML file.
    i want to do it from sqlplus rather than toad.pls help
    Thanks

    Oh..I'm in 9i.
    Try this out..and let me know.
    DECLARE
    CTX DBMS_XMLGEN.CTXHANDLE ;
    XML CLOB ;
    F UTL_FILE.FILE_TYPE;
    XMLC VARCHAR2(32767);
    BEGIN
    CTX := DBMS_XMLGEN.NEWCONTEXT('SELECT * FROM department1 ') ;
    XML := DBMS_XMLGEN.GETXML(CTX) ;
    XMLC:=TO_CHAR(XML);
    SHOW_ENVELOPE(XMLC);
    F := UTL_FILE.FOPEN('ATTACH_FILES','DEPT.XML', 'W');
    UTL_FILE.PUT_LINE(F,XML);
    UTL_FILE.FCLOSE(F);
    END ;
    Good luck!!!
    Bhagat
    null                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Error in Adobe Captivate 4: "unable to decode and import the selected wav - mp3 file"

    Good day!
    I have a problem. When i want to import music file from standart Gallery, i see the mistake: unable to decode and import the selected wav - mp3 file.
    I can't import mp3,wav files...
    In Adobe Help site i have found this: http://help.adobe.com/en_US/Captivate/4.0/Using/WS5b3ccc516d4fbf351e63e3d119e9582190-7fd8. html
    But in my Adobe Captivate 4 directory i don't have file regsvr32 NSAudio.dll.
    Question: where i can download this file?
    Thanks!

    Hi there
    As I recall there were two different "fixes" for audio with Captivate 4. One involved replacing the dll and another had something to do with installation problems on Windows XP. So give the link below a try.
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    Begin learning Captivate 5 moments from now! $29.95
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcererStone Blog
    Captivate eBooks

  • Unable to decode and import the select wav/mp3 file

    Hi,
    I've been TRYING to test the Text-to-speech feature in
    Captivate 4. Problem: "Unable to decode and import the select
    wav/mp3 file" each and every time I want to use it. Frustrating!
    I also tried importing sounds from the library, same problem.
    My system is Vista Business 64Bit, 4Gb RAM, Intel SSD hard
    drive, conexant high definition audio 221 on a Lenovo T400.
    How do I fit this? I want to try it out damnt :)

    I went through the "unable to decode and import the selected wav/mp3 file" error.  After talking with an Adobe Rep,  I quickly realized that I could NOT use the directions.  I have no experience in using Command Prompts.  I have written down the directions by key stroke for those people that are similar to me.  Enjoy!
    For Vista and Win7,
    Click on the circle start menu,
    In the search box, type in command and in the generated list, "right-click" on the comman link and change to "run as administrator".
    Go back to the search box, type in command and hit enter.  This will take you to the command prompt window (black window w/ white text) lol
    You have to get to the right directory first.
    Type: cd (space-bar) .. (hit enter)
    Type: cd (space-bar) .. (hit enter)
    If Captivate is installed on Program Files (x86) ---
    Type: cd (space-bar) progra~2 (hit enter)
    If Captivate is installed on Program Files
    Type: cd (space-bar) progra~1 (hit enter)
    Type: cd (space-bar) Adobe (hit enter)
    Type: cd (space-bar) Adobe (space-bar) Captivate (space-bar) 4 (hit enter)
    Type: regsvr32 (space-bar) NSAudio.dll (hit enter)
    If you get an error at any point, re-key that particular line.
    Once you see that the last line of command went through, open up Captivate and test the Text to Speech.  These instructions fixed both computers I was working on!!!!

  • CP4 unable to decode and import the selected wav/mp3 file

    I am trying to import a .wav file into a project and get an error message 'unable to decode and import the selected wav/mp3 file'.
    I have tried the solution huan_miguel posted a week ago for someone with the same problem.
    http://blogs.adobe.com/captivate/2009/03/adobe_captivate_4_installatio n.html
    executed all the steps described in this link.
    Unfortunately, the problem is still there.
    Any other solution?

    You're probably going to need to do both.
    Although Captivate can certainly accept a 10 meg audio file, you would need to add it to the movie and then synchronise the slides to the audio. Chopping the audio file up and adding the relevant bits to each slide has both advantages and disadvantages.  It's easier to control the playback synchronisation when you divide up the audio, but it's more work.
    Take a look at this graphic from SoundBooth when I export an audio file recorded in Captivate 5:
    Notice that it shows the bitrate of the Captivate WAV file as being 16 bit.  This is quite a low bitrate.  You can go as high as 32 bit in SoundBooth, however, in my experience, when you try to import a WAV into Captivate that is over 16 bit you will encounter issues.  Cp just doesn't seem to like it.
    If you want to learn more about bit rates in multimedia: http://en.wikipedia.org/wiki/Bit_rate
    Suffice to say, you need to find out what the current bit rate of the audio file is, and if necessary, save it as 16 bit for Captivate.  For this, you will require some kind of audio editing software.
    You can try using Audacity as someone else suggested: http://audacity.sourceforge.net/  and try exporting the file out as 16 bit.
    However, if you are going to be doing quite a bit of this type of work, I would suggest you invest in Adobe Soundbooth, or something of that ilk.  You'll enjoy the experience more.

  • How do I copy and paste from one page or file to another page or file - on the same screen?

    How do I copy and paste from one page or file to another - on the same screen?

      Open both of your images in the Editor. Click on the image you want to copy and press Ctrtl+A (select all) followed by Ctrl+C (copy) then click the tab for your other image and press Ctrl+V (paste)
    Alternatively click on your background image then simply drag the second image from the photo/project bin and drop it into the main editor workspace on top of the background image. Use the move tool to position and the corner handles of the bounding box to scale.

  • Transfered files from Mac Pro to iMac OS10.7. Copied bookmarks using "backup and restore" from "Organize bookmarks". File copied correctly as bookmarks 10-10-11.jsom, but would not restore on new iMac.

    Transfered files from Mac Pro to iMac OS10.7. Copied bookmarks using "backup and restore" from "Organize bookmarks". File copied correctly as bookmarks 10-10-11.jsom, but would not restore on Firefox on new iMac.

    Firefox 2 versions use the file bookmarks.html to store the bookmarks.
    See http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox
    See also http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    With Mac OS X 10.4 you can use Firefox 3.5 or 3.6
    * http://www.mozilla.com/firefox/all.html
    * http://www.mozilla.com/firefox/all-older.html
    *http://www.mozilla.com/en-US/firefox/system-requirements.html
    *http://www.mozilla.com/firefox/system-requirements-v3.html

  • Unable to decode and import the selected wav/mp3 file

    I am trying to import mp3's into a Captivate 3 presentation
    but keep getting this error "Unable to decode and import the
    selected wav/mp3 file." I am using the same mp3 files that I have
    used many times with projects in Cap1 and Cap2. I have converted
    the files to wav's and tried but I'm still getting the same
    message. I have a deadline and I'm stumped.
    Any ideas?

    Hi DianaUNC
    Interesting. I've seen it happen with WAV files but not MP3.
    Do you still have Captivate 2 around? If so, do these successfully
    import into Captivate 2? One thought was that you might pop them
    into something like Audacity and save them out again. Perhaps
    something is amiss with the encoding used.
    Or you might try the trick of opening them in Windows Sound
    Recorder and saving them out of that in a different format. I know
    that works with one particular WAV file I have.
    Cheers... Rick

  • Send WAV sound file to Modem

    Hi,
    After I use JavaComm API to dial to a phone with a common
    dialup/Fax Modem, is it possible to output a WAV sound file
    to the modem so that the receiver(the one pickup the phone
    remotely) can hear the voice?
    Best regards,
    Eric

    Look at the javax.sound.sampled api.
    If your modem is capable of sending digital audio it should appear as
    one of the available mixers. find the correct mixer and stream your
    audio to it.
    matfud

  • Xbee data extracting and graphing

    Hi,
    I have been trying for a few days to get this to work with no results. I have searched through google and some of the forums for help with nothing that really helped.
    I am using two xbee devices to transfer data to labview to graph.Eventually I would like to use the ADC on the Xbee to take an analog signal and convert it to a digital signal for labview to read and so I can do my analysis on it. I started with getting a basic Visa program to work and send number from my arduino uno over and over again and placing those values into an array This works great with no problems. The problem comes when I try and send a signal through the Xbee. 
    I tried to send an analog signal out to the adc and I was getting some values in labview in Hex but I was unsure what they really meant. My second attemp was just to try and create a pulse wave using my arduino and send that to labview and have labview try and graph the incoming signal. This however did not work and I am not getting any data. I connected both Xbees up on a bread board without labview to see if I can get the a signal out of the recieving xbee and it worked. So the problem should not be with my xbee's but with my code. 
    The code is where I am not sure about. I was able to find examples of how to use the visa and was given a basic example of it. I have then tried to manipulate the program to see if ti would work for me. I am trying to take the signal from the VISA Read funciton and convert it to a 1d array to display on a graph. I have also tried to seperate the dat into an array char by char from the string. However, none of this worked. I am getting a zero value out for my graph and no values into my array. I am also getting no value into my READ String area. 
    The values I have sometimes gotten look like:
    00\00\00\00\00\94\00\00\ and so on with different value. Some time the byte read is very large up to 475 when I am placing the pulse wave in or so and sometimes smaller at 19 when I tried to connect the ADC.
    I have attached some of my VI's to see if anyone can come up with a better way or point me in a better direction.
    The png is a pic of the results I got from the pulse input. So it looks like I am not getting any data at all. 
    Thanks for the help
    Juan
    Attachments:
    Basic VISA_Test_1.vi ‏26 KB
    Result_OfpulseWave.png ‏129 KB

    Hello jrod03,
    I would suggest using the NI LabVIEW Interface for Arduino Toolkit found here (http://sine.ni.com/nips/cds/view/p/lang/en/nid/209​835) and posting your Arduino related questions in our LabVIEW Interface for Arduino community (https://decibel.ni.com/content/groups/labview-inte​rface-for-arduino).
    This document will also probably be helpful to you (http://digital.ni.com/public.nsf/allkb/8C077471896​06D148625789C005C2DD6).
    Jonathan L.
    Applications Engineer
    National Instruments

  • Data Extraction and ODS/Cube loading: New date key field added

    Good morning.
    Your expert advise is required with the following:
    1. A data extract was done previously from a source with a full upload to the ODS and cube. An event is triggered from the source when data is available and then the process chain will first clear all the data in the ODS and cube and then reload, activate etc.
    2. In the ODS, the 'forecast period' field was now moved from data fields to 'Key field' as the user would like to report per period in future. The source will in future only provide the data for a specific period and not all the data as before.
    3) Data must be appended in future.
    4) the current InfoPackage in the ODS is a full upload.
    5) The 'old' data in the ODS and cube must not be deleted as the source cannot provide it again. They will report on the data per forecast period key in future.
    I am not sure what to do in BW as far as the InfoPackages are concerned, loading the data and updating the cube.
    My questions are:
    Q1) How will I ensure that BW will append the data for each forecast period to the ODS and cube in future? What do I check in the InfoPackages?
    Q2) I have now removed the process chain event that used to delete the data in the ODS and cube before reloading it again. Was that the right thing to do?
    Your assistance will be highly appreciated. Thanks
    Cornelius Faurie

    Hi Cornelius,
    Q1) How will I ensure that BW will append the data for each forecast period to the ODS and cube in future? What do I check in the InfoPackages?
    -->> Try to load data into ODS in Overwrite mode full update asbefore(adds new records and changes previous records with latest). Pust delta from this ODS to CUBE.
    If existing ODS loading in addition, introduce one more ODS with same granularity of source and load in Overwrite mode if possible delta or Full and push delta only subsequently.
    Q2) I have now removed the process chain event that used to delete the data in the ODS and cube before reloading it again. Was that the right thing to do?
    --> Yes, It is correct. Otherwise you will loose historic data.
    Hope it Helps
    Srini

  • Data extracting to BW from R3 taking too much time

    Hi,
    We have one delta data load to ODS from R3 this is taking 4-5 hours .this job runs in r3 itself for 4-5 hours even for 30-40 records.and after this ODS data updated to cube so but since in ODS itself takes too much time so delta brings 0 records in cube hence we have to update manually.
    Also as now job is running for load to ODS so can't we check records for delta in RSA3 Its giving me error saying  "error occurs during extraction ".
    can u please guide how we can make this loading faster if any index needs to be build how to proceed on that front
    Thanks
    Nilesh

    rAHUL,
    I tried with R its giving me dump with message "Resul of customer enhancemnet 19571 records"
    Erro details are -
    Short text
        Function module " " not found.
    What happened?
        The function module " " is called,
        but cannot be found in the library.
        Error in the ABAP Application Program
        The current ABAP program "SAPLRSA3" had to be terminated because
        come across a statement that unfortunately cannot be executed.
    What can you do?
        Note down which actions and inputs caused the error.
        To process the problem further, contact you SAP system
        administrator.
        Using Transaction ST22 for ABAP Dump Analysis, you can look
        at and manage termination messages, and you can also
        keep them for a long time.

  • XML data extraction and new row display

    I have a table named, SAPDATABROWSER, which has multiple columns and rows. A column named SAPTEXT (DataType: CLOB) consist of xml data. Each XML data is different in terms of number of nodes, but has the same following structure:
    <SAP_BAPI_PROP>
    <SelectedProperty>
    <Structure>
    <Field></Field>
    <Length></Length>
    <FieldValue></FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>
    </SAP_BAPI_PROP>
    So now what I would like to do is, to extract the values: Field, FieldValue and Length from every row (total 72) and display the result as following,
    Field FieldValue Length
    XXXX YYYY ZZZZ
    PPPP QQQQ RRRR
    AAAA BBBB CCCC
    MMMM NNNN OOOO
    Again, each row (total 72) has multiple nodes inside XML data, i.e there are multiple Field,Length and FieldType Nodes and no two XML row/data are similar!
    I am using the following code:
    SELECT
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/Field/text()'),
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/Length/text()' ),
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/FieldValue/text()' )
    FROM sapdatabrowser ;
    The above code generate result as following:
    /SAP_BAPI_PROP/..../Field/text() /SAP_BAPI_PROP/..../Length/text() /SAP_BAPI_PROP/..../FieldValue/text()
    1. XXXXPPPPAAAA YYYYQQQQBBBB ZZZZRRRRCCCC
    2. MMMM NNNN OOOO
    Any suggestions?! Thank you very much. :)

    Thank you everyone for your input. But I am still stuck. Let me start with my SQL version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionI believe my explaination was not clear so let me rephrase my question. Following is a screenshot of the Table SAPDATABROWSER
    http://img585.imageshack.us/img585/2724/55760509.jpgSo there are total 72 rows, and my interest is in Column 6, SAPTEXT (type:CLOB). Each of the row has following structure:
    <SelectedProperty>
    <Structure>
    <Field></Field>
    <Length></Length>
    <FieldValue></FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>Each row has multiple nodes Field, Length, FieldValue.... etc. Now I would like to extract ALL: Field, Length and FieldValue nodes from ALL rows and display them in following format
    Field                  Length                   FieldValue
      1                       1                           1
      2                       2                           2
      3                       3                           3
      4                       4                           4Example Output:
    ROW 1:
    <SelectedProperty>
    <Structure>
    <Field>X</Field>
    <Length>Y</Length>
    <FieldValue>Z</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    <Structure>
    <Field>P</Field>
    <Length>Q</Length>
    <FieldValue>R</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>
    ROW 2:
    <SelectedProperty>
    <Structure>
    <Field>A</Field>
    <Length>B</Length>
    <FieldValue>C</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    <Structure>
    <Field>M</Field>
    <Length>N</Length>
    <FieldValue>O</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>Required Output:
    Field                  Length                   FieldValue
      X                       Y                           Z
      P                       Q                           R
      A                       B                           C
      M                       N                           O

Maybe you are looking for

  • Does ALDSP 2.5 supports INOUT cursor??

    Hi, We are using ALDSP 2.5 and trying to connect to oracle stored procs. Some of these stored procs have INOUT Cursor, INPUT cursor and associate array types. Does ALDSP 2.5 supports this?? If not please let me know whether other versions support thi

  • Tell me about pop up window in abap

    hi all,                i want to do a pop up message .           when material stock is below the lower limit.          it give the automatic message to user to take the action .       pls  tell me how i can do this in abap. regards vikas .

  • How to convert ALAC to 256kbps for ipod when syncing?

    I have a large library of apple ALAC files ripped from CD into itunes and I want to have an easy way of converting to a lessor quality version for syncing with the  ipod.  The problem i don't want duplicates and I want higher than 128 so the check bo

  • NEF to DNG

    When converting to DNG does ALL the EXIF data come across? I ask this because if I open a NEF file with Capture NX2 I can see details about my off-camera flash groups that I have used. Lightroom 2 or ACR does not seem to show this which is OK, I'm mo

  • Mac pro 2014 restarting unexpedly

    Well. I just posted about this and Apple removed my post. I guess I put too much emotion into my post. So this time i'll shorten it: My $10,000 mac pro keeps restarting with no warning. Apple refuses to replace it or give me a refund. I am hurt. Anyo