JOHZEN

花に風


  • Home

  • Projects

  • Portfolio

  • About

  • Tags

  • Categories

  • Archives

  • Search

cin 后使用 getline()

Posted on 2019-02-10 | In tech , coding | | Views:

若要在 cin 后使用 getline(),需要用 cin.ignore() 跳过接受的回车符,否则 getline() 会无法接收到目标字符串。

看以下这段代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include<string>

using namespace std;

int main()
{
int a;
cin >> a;
string s;
cin.ignore(); // 跳过'/n'
getline(cin, s);
cout << a << " " << s << endl;
return 0;
}

若没有 cin.ignore(), s 接收到的字符串始终为空行。

避免使用 vector-bool

Posted on 2019-02-03 | In tech , coding | | Views:

vector<bool> 在STL中被优化为每个bool之占用一个bit而不是一个字节的内存,这导致地址可能不能被正确的返回,所以要避免 vector<bool> 的使用,可以用 vector<int> 代替。

混响时间的资料

Posted on 2019-01-25 | In tech , audio | | Views:

-> http://hyperphysics.phy-astr.gsu.edu/hbase/Acoustic/revtim.html

Highlights

  • $\text{RT}_{60}$: time to drop $60~\text{dB}$ below original level.
  • For a general purpose auditorium for both speech and music: 1.5 to 2.5 seconds.
    • Longer RT: richer musical sound, more difficulty understanding speech.
    • Shorter RT: clearer speech, loss of richness and fullness.
  • Reverberation time approximation: Sabine formula, $\text{RT}_{60} = 0.16 \frac{V}{S_e}$, $S_e$ is the effective absorbing area, $a$ is the absorption coefficient. $S_e=a_1S_1+a_2S_2+a_3S_3+\cdots$. -> http://hyperphysics.phy-astr.gsu.edu/hbase/Acoustic/revmod.html#c2
  • Examples of reverberation times:
    • Vienna, Musikvereinsaal: 2.05 seconds
    • Boston, Symphony Hall: 1.8 seconds
    • New York, Carnegie Hall: 1.7 seconds

ARD simulator

Posted on 2019-01-23 | Edited on 2019-01-26 | In tech , audio | | Views:

完成了一个基于 ARD 的三维声场仿真程序 -> https://jinnsjj.github.io/ARD-simulator/

pre-defense

Posted on 2018-12-06 | In tech , audio | | Views:

sound space rendering based on the virtual sphere model pre-defense from JunjieShi3

论文笔记 - HOA 的必读论文 poletti2005

Posted on 2018-11-13 | Edited on 2019-01-23 | In note | | Views:

Three-dimensional surround sound systems based on spherical harmonics

Poletti, M. A. (2005). Three-dimensional surround sound systems based on spherical harmonics. Journal of the Audio Engineering Society, 53(11), 1004-1025.


Introduction

Approaches to 3D sound field reproduction

  1. The Kirchhoff–Helmholtz integral
    • The Kirchhoff–Helmholtz integral shows that reproduction is possible inside a region if the pressure and normal velocity are known on the surface of the region.
    • basis for the wave field synthesis (WFS).
    • In practice simplifications are possible; for example, monopole sources are sufficient, and only those transducers in the direction of the sound source are required.
  2. Inverse method
    • an inverse matrix is derived for a given geometry of loudspeakers and receiver positions, which allows the creation of the required sound pressure at a set of discrete points.
  3. 3D Ambisonics approach
    • based on a spherical harmonic decomposition of the sound field

This paper reviews and extends the theory of 3D sound systems based on spherical harmonics.

Read more »

Matlab 音频低通滤波

Posted on 2018-11-07 | Edited on 2018-11-14 | In tech , audio | | Views:

用仿真生成的 transfer function,再高频部分精确度比较糟糕,所以希望只保留一定频率以下的部分,需要设计一个低通滤波器。这里介绍最为直接的办法,使用 matlab 里的 fir1 函数设计滤波器,并用 fftfilt 进行滤波。

1
2
3
4
b = fir1(n,fcut/(Fs/2));    % 第一个参数n是fir阶数,对应滤波器在时域的长度。
% 第二个参数是相对截止频率。
% 音频采样率Fs,对应的最高频率就是Fs/2,fcut是实际的截止频率。
y = fftfilt(b,x) % 假设x是原始信号,用fftfilt对x进行滤波。

https://www.mathworks.com/help/signal/ref/fir1.html
https://www.mathworks.com/help/signal/ref/fftfilt.html

matlab中实际应用代码

冥想

Posted on 2018-11-05 | Edited on 2018-11-14 | In meditation | | Views:

我站在阳台冥想,想要了解生命的意义。
远方的天空,一下泛蓝,一下泛红。
但我猜那只是云后飞机的灯。
附近河的流水吵吵闹闹。
我想要抛开世界的噪音,洁净我的灵魂。
我点燃一根烟,弄脏我的肺。

linux 上的小玩具 cmatrix 和 cowsay

Posted on 2018-11-02 | Edited on 2018-11-14 | In tech | | Views:

在 linux 上打发时间,发现两个无用但有趣的小玩具,cmatrix 和 cowsay。安装分别用 sudo apt-get install cmatrix 和 sudo apt-get install cowsay。

cmatrix 的效果是很俗的下字母雨。

cmatrix.gif

cowboy 则是画一头牛,让它说一句话。

1
2
3
4
5
6
7
8
9
$ cowsay 咩
____
< 咩 >
----
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||

Have fun!

Matlab 窗可视化工具 wvtool

Posted on 2018-11-01 | Edited on 2018-11-14 | In tech | | Views:

通过matlab的 wvtool 可以看到不同窗的时域和频域特性,使用起来也十分方便。

1
wvtool(hamming(64),hann(64),gausswin(64))

Window Visualization Tool.jpg

https://www.mathworks.com/help/signal/ref/wvtool.html

123
Jon

Jon

23 posts
6 categories
28 tags
RSS
GitHub CSDN
Creative Commons
0%
© 2018 — 2019 Jon
Powered by Hexo v3.7.1
|
Theme — NexT.Pisces v6.3.0