Giter Club home page Giter Club logo

pcm2wav-py's Introduction

PCM2Wav-py

This library implements a converter for PCM data to Wav audio format, obtained with logic analyzers.

For example I2S signals obtained with the Saleae logic analyzer.

Current supported formats

  • I2S signals obtained and exported with the Saleae logic analyzer.
  • I2S signals obtained with Sigrok (Software that supports multiple hardware devices)

Installation

(sudo) pip install PCM2Wav

Usage

python
from PCM2Wav import *
output = PCM2Wav(PCM2Wav.saleae.I2S, "i2s.csv", "example.wav")

pcm2wav-py's People

Contributors

roel-bausch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pcm2wav-py's Issues

Doesnt work with saleae-logic-alpha 2.3.13-1

Hi,

Thanks for the great work.
This software doesn't seems to work with the latest saleae-logic-alpha 2.3.13-1.

There are two ways to export the data:

Time [s] | Channel 0 | Channel 1 | Channel 2
1.20147512 | 1 | 0 | 0
1.20147544 | 0 | 0 | 0
1.20147577 | 1 | 0 | 0
1.20147609 | 0 | 0 | 0
1.20147642 | 1 | 0 | 0

Or

name | type | start_time | duration | channel | data
I2S / PCM | data | 1.20148586 | 9.76E-06 | 0x0000000000000001 | 0x0000000000000000
I2S / PCM | data | 1.20149628 | 9.76E-06 | 0x0000000000000000 | 0x0000000000000000
I2S / PCM | data | 1.20150669 | 9.77E-06 | 0x0000000000000001 | 0x0000000000000000
I2S / PCM | data | 1.20151711 | 9.76E-06 | 0x0000000000000000 | 0x0000000000000000
I2S / PCM | data | 1.20152753 | 9.76E-06 | 0x0000000000000001 | 0x0000000000000000
I2S / PCM | data | 1.20153794 | 9.77E-06 | 0x0000000000000000 | 0x0000000000000000
I2S / PCM | data | 1.20154836 | 9.76E-06 | 0x0000000000000001 | 0x0000000000000000

Neither of these two ways seems to generate a valid file.

Channel numbering is not being handled

I've noticed that when calling the PCM2Wav constructor, it is not taking the channel number specified in the CSV file into consideration. For example, if we have the following CSV sample:

0.000011560000000,2,0
0.000021960000000,1,6785
0.000032360000000,2,0
0.000042800000000,1,6906
0.000053200000000,2,0
0.000063640000000,1,5487

The generated WAV file will have a silent left channel (since it takes whatever is in the first row as left channel, despite being channel 2). If we remove the first line, the generated WAV file will now have a silent right channel (i.e. swapped channels). Do you think this is something that this module should automatically handle?

UnboundLocalError 'channels'

I'd like to convert Saleae logicpro pcm file to wav,
But it shows some issue.

  1. UnboundLocalError 'channels'

File "D:\python_project\pcm2wav2\PCM2Wav\PCM2Wav.py", line 54, in _generate
frame = self._calc_frame(channels)
UnboundLocalError: local variable 'channels' referenced before assignment

  1. short variable format issue.

Source code only support 'short' variable format:(-32768) <= supported value <= 32767
So, it makes error when value is out of range.
Some value was 65532,......
Can I modify "__formats = {1: 'c', 2: 'h'}" --> __formats = {1: 'c', 2: 'i'}?

  1. Can somebody share good example of csv file working with this source code?
  • I attached what I used csv file.

i2s.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.