Git Product home page Git Product logo

go-dsp's People

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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

go-dsp's Issues

float32 support (or: mismatch in APIs)

The golang-users thread you announced this in suggests you used to have a float32 interface, but replaced it by float64, right? I'm asking because Im currently writing float32tofloat64 and float64tofloat32 array conversion routines and Im wondering why. The wav package produces float32s, but the other packages consume float64, which feels a little weird for two packages from the same repos.

I'm trying to tie it into some opus unit tests and libopus also works with float32, as I assume many others do.

Im curious to know: what made you drop float32?

(golang) High pass filter method question

HI.
I am new in golang.

I want open file and do HPF and save the file after HPF.

the file format is
1 28.00000
2 29.00000
3 28.00000
4 30.00000
5 28.00000
.....
.....

it has two column
(time well_height)

the sample rate is 0.0166Hz (60 seconds interval well height recording)
It has very very long term noise more than 200 sec
So I want to High pass filter with cutoff frequency 0.005 Hz

I looked over your golang code very carefully with 1 week
but Still I failed with your code.

Is there any sample form with open file and do HPF and save to file with HPF results ?

please help me. I am graduate course student.

Thanks for all.

TaeRhee
sample_part_small.txt

Fourier transform example?

I would love an example of using the Fourier transform utilities on one of the sample wav files. In fact, there are several algorithms here that could use a usage demonstration.

FFTReal output doesn't seem right

I'm sure this is my fault, but I can't see what I'm doing wrong.

Given the following simple program, when the input is a 440Hz sine wave, I expect to see a single peak in the frequency domain. Giving the same input to an online FFT calculator, the expected output is obtained.

Can you point out my mistake, or is go-dsp doing something strange?


The Program

package main

import (
    "bufio"
    "fmt"
    "github.com/mjibson/go-dsp/fft"
    "github.com/mjibson/go-dsp/window"
    "math"
    "os"
    "strconv"
)

func main() {
    file, err := os.Open(os.Args[1])
    if err != nil {
        panic(err)
    }

    scanner := bufio.NewScanner(file)
    values := make([]float64, 0)
    for scanner.Scan() {
        line := scanner.Text()
        value, e := strconv.ParseFloat(line, 64)
        if e != nil {
            panic(e)
        }
        values = append(values, value)
    }

    fftComplex := doFft(values)
    fftReal := realize(fftComplex)

    for _, freq := range fftReal {
        fmt.Println(freq)
    }
}

func doFft(data []float64) []complex128 {
    window.Apply(data, window.Hamming)
    return fft.FFTReal(data)
}

func realize(data []complex128) []float64 {
    realVals := make([]float64, len(data))
    for i, comp := range data {
        rel := math.Pow(real(comp), 2)
        img := math.Pow(imag(comp), 2)
        realVals[i] = math.Sqrt(rel + img)
    }
    return realVals
}

It's run like:

go run fft.go awave.dat > awave-dsp.fft

The Input

Data is here, it's 440Hz sine. Plotted it looks like:
screen shot 2014-03-09 at 3 53 19 pm

gnuplot -e "plot 'awave.dat'; pause -1"

The Output

Data is here. Plotted it looks like:
screen shot 2014-03-09 at 3 54 35 pm

The x-scale here isn't Hz, it's just the bin numbers from FFTReal.

gnuplot -e "plot 'awave-dsp.fft'; pause -1"

Expected Output

Using the same input, and the online FFT mentioned above, I get the expected output:
screen shot 2014-03-09 at 3 54 54 pm

examples

Hoping its possible to have more examples of common usage of the library. For example, it would be interesting to have a sample program that reads a wav file and segments the file into meaningful features perhaps providing a recognition example?

License

Hey,

What license is this code released under? Can I use it in a commercial project?

Thanks!

Possible memory leak

Invoking fft.FFT() many times for large wav files (~10MB) couses program to panic because of out of memory.
I have tested my program with and without that single line. Without computing fft it occupies ~300MB for very long time. When I enable fft computing it will be 3GB of RAM occupied pretty fast.

2d FFTs

I hope your To-Do list includes at least 2d FFTs?

24 bit files

What exactly would need to happen to support 24bit. I'd love to take a stab at implementing support.

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.