Giter VIP home page Giter VIP logo

demod's People

Contributors

andresv avatar mvdswaluw avatar ritikmishra avatar takurx 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demod's Issues

USB/LSB demod?

Hi,

I'm looking for a command line tool to demodulate USB/LSB for Raspberry Pi autonomous WSPR reception. As I see in the code, only FM is supported? No plans to add USB/LSB/SSB?

Thanks

Build for older platform

This is all nice, kudos for this tool.

I compiled older, C version of demod & all I get is white noise, even with strong FM station.

I can't get Rust version to compile for specific x86 platform, how to do that? Rust seems to compile liquid-dsp on it's own & I need to provide specific --march options. Any help would be nice. Thanks.

Why divide by 32768?

On lines 108 and 109 in main.rs, why do we divide the f32s by 32768? What does this action achieve?

When reading these lines, it appeared to me that the bitwise operations successfully converted the u8 values into f32 values, but I don't quite understand why they're divided by a number afterward.

let i: f32 = ((b[1] as i16) << 8 | b[0] as i16) as f32 / 32768.;
let q: f32 = ((b[3] as i16) << 8 | b[2] as i16) as f32 / 32768.;

no function or associated item named `new` found

Compiling demod v0.9.6 (file:///home/kammajaa/demod)
error[E0599]: no function or associated item named new found for type clap::SubCommand<'_> in the current scope
--> src/usage.rs:113:29
|
113 | .subcommand(SubCommand::new("fm")
| ^^^^^^^^^^^^^^^ function or associated item not found in clap::SubCommand<'_>

error: aborting due to previous error

error: Could not compile demod.

optimize error? (cargo release build is failed, cargo debug build is successed)

It's strange. Is it might be depend to be update library, crates.io? Thanks.

  • cargo release build is failed
pi@raspberry:~/demod $ cargo build --release
   Compiling libc v0.2.39
   Compiling num-traits v0.2.1
   Compiling rustc-serialize v0.3.24
   Compiling unicode-width v0.1.4
   Compiling vec_map v0.8.0
   Compiling strsim v0.7.0
error: Could not compile `libc`.

Caused by:
  process didn't exit successfully: `rustc --crate-name libc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.39/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 --cfg 'feature="default"' --cfg 'feature="use_std"' -C metadata=caac43181e7a38c2 -C extra-filename=-caac43181e7a38c2 --out-dir /home/pi/demod/target/release/deps -L dependency=/home/pi/demod/target/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
thread '<unnamed>' panicked at 'src/librustc_codegen_ssa/back/write.rs:1545: worker thread panicked', src/librustc/util/bug.rs:37:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: failed to parse bitcode for LTO module: file doesn't start with bitcode header

error: aborting due to previous error

free(): invalid next size (fast)
error: Could not compile `strsim`.

Caused by:
  process didn't exit successfully: `rustc --crate-name strsim /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/strsim-0.7.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=e69152eb05c2cfdc -C extra-filename=-e69152eb05c2cfdc --out-dir /home/pi/demod/target/release/deps -L dependency=/home/pi/demod/target/release/deps --cap-lints allow` (signal: 6, SIGABRT: process abort signal)
warning: build failed, waiting for other jobs to finish...
error: Could not compile `num-traits`.

Caused by:
  process didn't exit successfully: `rustc --crate-name num_traits /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=ba597cbdaa1cf83d -C extra-filename=-ba597cbdaa1cf83d --out-dir /home/pi/demod/target/release/deps -L dependency=/home/pi/demod/target/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: Could not compile `rustc-serialize`.

Caused by:
  process didn't exit successfully: `rustc --crate-name rustc_serialize /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=bdf678104c710bcc -C extra-filename=-bdf678104c710bcc --out-dir /home/pi/demod/target/release/deps -L dependency=/home/pi/demod/target/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
  • cargo debug build is successed
pi@raspberry:~/demod $ cargo build
   Compiling libc v0.2.39
   Compiling num-traits v0.2.1
   Compiling rustc-serialize v0.3.24
   Compiling unicode-width v0.1.4
   Compiling vec_map v0.8.0
   Compiling bitflags v1.0.1
   Compiling ansi_term v0.11.0
   Compiling strsim v0.7.0
   Compiling textwrap v0.9.0
   Compiling rand v0.4.2
   Compiling atty v0.2.8
   Compiling num-integer v0.1.36
   Compiling clap v2.31.1
   Compiling num-iter v0.1.35
   Compiling num-bigint v0.1.43
   Compiling num-complex v0.1.43
   Compiling num-rational v0.1.42
   Compiling num v0.1.42
   Compiling liquid_dsp v0.3.0 (https://github.com/cubehub/rust-liquid-dsp.git#343bf9bd)
   Compiling demod v0.9.7 (/home/pi/demod)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 42s

I append Cargo.toml, release build option.

  • Cargo.toml
[profile.release]
opt-level = 0

It can build unoptimize release build.

pi@raspberry:~/demod $ cargo build --release
   Compiling libc v0.2.39
   Compiling num-traits v0.2.1
   Compiling rustc-serialize v0.3.24
   Compiling unicode-width v0.1.4
   Compiling vec_map v0.8.0
   Compiling strsim v0.7.0
   Compiling bitflags v1.0.1
   Compiling ansi_term v0.11.0
   Compiling textwrap v0.9.0
   Compiling rand v0.4.2
   Compiling atty v0.2.8
   Compiling num-integer v0.1.36
   Compiling clap v2.31.1
   Compiling num-iter v0.1.35
   Compiling num-bigint v0.1.43
   Compiling num-complex v0.1.43
   Compiling num-rational v0.1.42
   Compiling num v0.1.42
   Compiling liquid_dsp v0.3.0 (https://github.com/cubehub/rust-liquid-dsp.git#343bf9bd)
   Compiling demod v0.9.7 (/home/pi/demod)
    Finished release [unoptimized] target(s) in 1m 27s

Writing i16 data to stdout is slow

It is slow because only 2 byes are written with one stdout.write(..).

let mut demod_out = vec![0_f32; resampler_output_len as usize];

match args.outputtype.unwrap() {
                    I16 => {
                        for i in 0 .. resampler_output_count as usize {
                            if demod_out[i] > 1.0 {
                                demod_out[i] = 1.0;
                            }
                            if demod_out[i] < -1.0 {
                                demod_out[i] = -1.0;
                            }

                            let sample: [i16; 1] = [(demod_out[i] * 32767_f32) as i16];
                            let slice = unsafe {slice::from_raw_parts(sample.as_ptr() as *const _, 2)};
                            stdout.write(&slice).map_err(|e|{println_stderr!("stdout.write error: {:?}", e); exit(1);});
                            stdout.flush().map_err(|e|{println_stderr!("stdout.write error: {:?}", e); exit(1);});
                        }
                    }
                    F32 => {
                        let slice = unsafe {slice::from_raw_parts(demod_out.as_ptr() as *const _, (resampler_output_count * 4) as usize)};
                        stdout.write(&slice).map_err(|e|{println_stderr!("stdout.write error: {:?}", e); exit(1);});
                        stdout.flush().map_err(|e|{println_stderr!("stdout.write error: {:?}", e); exit(1);});
                    }
                }

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.