Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
resources:tools-software:a2b-bus-analyzer:faq [27 Jan 2023 14:55] – Added clarification about which devices are supported S Fernandezresources:tools-software:a2b-bus-analyzer:faq [09 Feb 2023 16:48] – Device not found in GUI S Fernandez
Line 66: Line 66:
  
 A: Some instances may already be active or enabled remotely. Check the task manager, then remove any unneeded instances. A: Some instances may already be active or enabled remotely. Check the task manager, then remove any unneeded instances.
 +
 +** Q: I can see my Analyzer Device in the Device Manager but the Analyzer GUI does not show it, what is the problem? **
 +A: There are different reasons why the analyzer GUI may not be able to detect the Analyzer board.
 +
 +  * The A2B Analyzer device is being powered via USB which is not supported.\\ Please power it with the power supply that was enclosed with the product.
 +  * The port that the A2B Analyzer device is already in use by another application in the system.\\ By default the GUI uses port 5000. While the UI tries to detect when other applications are using the port and show a user notification, sometimes it is not capable of doing so and it just cannot show the Analyzer device in the dropdown. If this happens, you can change the port used by setting the environment variable A2B_ANALYZER_PORT to another value, for example 5001. To do this please refer to how to set up environment variables in your OS of choice.
 +To know if your computer is using port 5000 you can run the command netstat -abon and search for 5000 in your results.
  
 ** Q: How do I export a .dat file from Sigma studio? ** ** Q: How do I export a .dat file from Sigma studio? **
Line 158: Line 165:
 ** Q: Can a device be used from the UI and the SDK at the same time? ** ** Q: Can a device be used from the UI and the SDK at the same time? **
 A: The shared libraries used by the SDK and the UI are completely separate and they do not interact. This means that when trying to use the same device, both the UI and the SDK try to use the same USB which results in a failure. A: The shared libraries used by the SDK and the UI are completely separate and they do not interact. This means that when trying to use the same device, both the UI and the SDK try to use the same USB which results in a failure.
 +
 +===== FAQs on Advanced Use cases =====
 +
 +** Q: How can I record more than 2 channels with the A2B Bus Analyzer? **
 +
 +A: In the current implementation, the File Out control in the A2B Bus Analyzer UI can record a maximum of 2 channels due to the USB bandwidth required to poll the FW for data.
 +
 +If you need to record more channels, you can set up the required channels to USB Out in the UI and then capture the USB Out traffic with the following python script. This script only deals with the saving of the data. If you are using the user-accessible SDK with python scripts instead of the UI you can also incorporate the relevant parts of this code to your own scripts.
 +
 +Steps to follow:
 +
 +  * Install python 3.8.5: https://www.python.org/downloads/release/python-385/
 +  * Install python modules directly: python -m pip install datetime scipy numpy sounddevice
 +  * Install pyinstaller dependency: pip install pyinstaller   (optional if you want to create an executable instead of running the script from python)
 +
 +     **Python Script in file A2B_Bus_Analyzer_USBIn_Audio_Record.py**
 +<code python>
 +import sys
 +import os
 +from scipy import signal
 +from scipy.io import wavfile
 +import sounddevice as sd
 +
 +def record_audio(sec=5):
 +    # Function to detect peak freq in the wav file
 +    fs = 48000
 +    seconds = sec
 +    searchStr = "Microphone (A2B Bus Analyzer), Windows WDM-KS (32 in, 0 out)"
 +    strDevices = str(sd.query_devices())
 +    valDevice = strDevices.find(searchStr)
 +    if (valDevice == -1):
 +        print("Error: Audio device, \"" + searchStr + "\" not found")
 +        exit(1)
 +    deviceNum = int(strDevices[valDevice-3:valDevice-1])
 +    print("Info: Audio Device ID is: " + str(deviceNum))
 +    sd.default.device = [deviceNum, 4]
 +    myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=22)
 +    sd.wait()
 +    if os.path.exists("audio-stream.wav"):
 +        input("Warning: About to remove audio-stream.wav. Save file to avoid data loss.")
 +        os.remove("audio-stream.wav")
 +    wavfile.write('audio-stream.wav', fs, myrecording)
 +
 +if __name__=="__main__":
 +    while True:
 +        run_time = input("Enter the number of seconds to run: ")
 +        print("Info: Running for " + str(run_time) + " seconds.")
 +        record_audio(int(run_time)) # Use this for recording line in connected
 +</code>
 +  * Generate a Python executable: Generate .exe by running the command below (optional to generate an executable for the script)
 +      -  pyinstaller --onefile A2B_Bus_Analyzer_USBIn_Audio_Record.py
 +      -  .exe will be generated in the dist folder
 +
 +**Note**: Create the .exe once in your PC and then use .exe for further recording sessions.
 +
 +The command prompt just expects no. of seconds for recording.
 +The multi-channel wav file is recorded as audio-stream.wav.
 +
resources/tools-software/a2b-bus-analyzer/faq.txt · Last modified: 16 Nov 2023 18:50 by S Fernandez