Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goertzel-nostd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephen D
goertzel-nostd
Commits
e9db206d
Commit
e9db206d
authored
9 years ago
by
Matt McPherrin
Browse files
Options
Downloads
Patches
Plain Diff
unexpand PI path, some whitespace tweaks
parent
c86e0daf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+2
-2
2 additions, 2 deletions
src/lib.rs
with
2 additions
and
2 deletions
src/lib.rs
+
2
−
2
View file @
e9db206d
...
...
@@ -24,7 +24,7 @@ pub struct Partial {
impl
Parameters
{
pub
fn
new
(
target_freq
:
f32
,
sample_rate
:
u32
,
window_size
:
usize
)
->
Self
{
let
k
=
target_freq
*
(
window_size
as
f32
)
/
(
sample_rate
as
f32
);
let
omega
=
(
f32
::
consts
::
PI
*
2.
*
k
)
/
(
window_size
as
f32
);
let
omega
=
(
PI
*
2.
*
k
)
/
(
window_size
as
f32
);
let
cosine
=
omega
.cos
();
Parameters
{
window_size
:
window_size
,
...
...
@@ -81,7 +81,7 @@ fn sine() {
let
step
=
1.
/
8000.
;
for
sample
in
(
0
..
8000
)
{
let
time
=
sample
as
f32
*
step
;
buf
[
sample
]
=
((
time
*
freq
*
2.
*
PI
)
.sin
()
*
std
::
i16
::
MAX
as
f32
)
as
i16
;
buf
[
sample
]
=
((
time
*
freq
*
PI
*
2.
)
.sin
()
*
std
::
i16
::
MAX
as
f32
)
as
i16
;
}
let
p
=
Parameters
::
new
(
freq
,
8000
,
8000
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment